<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.global.js"></script>
</head>

<body>
    <div id='box'>
        <input type="text" placeholder="请输入用户名" v-model="useName"/><br>
        <input type="password" placeholder="请输入密码" v-model="password"/><br>
        <button v-on:click="login">登录</button>
    </div>
    <script>
        Vue.createApp({
            data() {
                return {
                    str: 'hello',
                    useName:'',
                    password:''
                }
            },methods: {
                login(){
                    if(this.useName === "admin" && this.password === "123"){
                        alert('登录成功')
                        location.href = 'index.html'
                    }
                }
            }
        }).mount('#box')
    </script>
</body>

</html>